{extend name="../../base/view/common/base" /}
<!-- 主体 -->
{block name="style"}
<link rel="stylesheet" href="{__STATIC__}/layui/plugin/dtree/dtree.css">
<link rel="stylesheet" href="{__STATIC__}/layui/plugin/dtree/font/dtreefont.css">
{/block}
{block name="breadcrumb"}
<span class="layui-breadcrumb">
	<a href="https://www.gougucms.com/" target="_blank">勾股DEV</a>
	<a><cite>项目中心</cite></a>
</span>
{/block}
{block name="body"}
<div class="table-content p-3">
	<div class="layui-form-bar border-t border-x">
		<button class="layui-btn layui-btn-sm add-project">+ 新建项目</button>
	</div>
	<table class="layui-hide" id="projectList" lay-filter="project"></table>
</div>
{/block}
<!-- /主体 -->

<!-- 脚本 -->
{block name="script"}
<script>
	function init(layui) {
		var table = layui.table, form = layui.form, gougu = layui.gougu;
		layui.pageTable = table.render({
			elem: '#projectList',
			title: '项目列表',
			cellMinWidth: 300,
			page: true, //开启分页
			limit: 20,
			url: "/project/index/index", //数据接口
			cols: [[
				{
					field: 'id', title: '项目编号', width: 80, align: 'center', fixed: 'left', rowspan: 2, templet: function (d) {
						return 'M' + d.id;
					}
				}
				, {
					field: 'status', title: '状态', align: 'center', width: 70, rowspan: 2, templet: function (d) {
						var html = '<span class="layui-btn layui-btn-xs bg-status-' + d.status + '">' + d.status_name + '</span>';
						return html;
					}
				}
				, {
					field: 'name', title: '项目名称', rowspan: 2, templet: function (d) {
						var html = '<a class="open-link" href="/project/index/view/id/' + d.id + '">' + d.name + '</a>';
						return html;
					}
				}
				, { field: 'director_name', title: '负责人', align: 'center', width: 80, rowspan: 2 }
				, { field: 'plan_time', title: '项目周期', align: 'center', width: 190, rowspan: 2 }
				, { align: 'center', title: '关联任务', colspan: 3 }
				, { align: 'center', title: 'BUG缺陷', colspan: 3 }
			], [
				{ field: 'tasks_a_unfinish', align: 'center', style: 'color: #91CC75;', width: 72, 'title': '进行中' }
				, { field: 'tasks_a_finish', align: 'center', style: 'color: #FAC858;', width: 70, 'title': '已完成' }
				, { field: 'tasks_a_pensent', align: 'center', style: 'color: #EE6666;', width: 72, 'title': '完成率' }
				, { field: 'tasks_b_unfinish', align: 'center', style: 'color: #91CC75;', width: 72, 'title': '进行中' }
				, { field: 'tasks_b_finish', align: 'center', style: 'color: #FAC858;', width: 72, 'title': '已完成' }
				, { field: 'tasks_b_pensent', align: 'center', style: 'color: #EE6666;', width: 72, 'title': '修复率' }
			]]
		});

		$('.layui-form-bar').on('click','.add-project', function () {
			gougu.open('/project/index/add');
		});
	}		
</script>
{include file="../../base/view/common/layui" base='base' extend="['gougu','employeepicker','gouguEdit','gouguComment']"
callback="init" /}
{/block}
<!-- /脚本 -->